#include <iostream>
#define max 110
using namespace std;
int main() {
    int num[max];
    int i=0;
    int length=0; //记录数组长度
    while (i< max){
        scanf("%d",&num[i]);
        if (num[i]==0){
            break;
        }
        i++;
        length++;
    }

    for (int j = length-1; j >=0 ;j--) {
        printf("%d ",num[j]);
    }
    return 0;
}
